/**
 * Created with IntelliJ IDEA.
 * Description:多线程练习
 * User: 邓大帅
 * Date: 2024-01-27
 * Time: 12:33
 */
import java.util.concurrent.locks.LockSupport;

public class ThreadDemo9 {
    static Thread t1,t2,t3;
    public static void main(String[] args) {
        t1 = new Thread(()->{
            for (int i = 0; i < 10; i++) {
                LockSupport.park();
                System.out.print("A");
                LockSupport.unpark(t2);
            }
        });
        t2 = new Thread(()->{
            for (int i = 0; i < 10; i++) {
                LockSupport.park();
                System.out.print("B");
                LockSupport.unpark(t3);
            }
        });
        t3 = new Thread(()->{
            for (int i = 0; i < 10; i++) {
                LockSupport.unpark(t1);
                LockSupport.park();
                System.out.println("C");
            }
        });
        t1.start();
        t2.start();
        t3.start();
    }
}